﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace OpenNETCF.Bookshare.Services.ISBNDB
{
    internal class AuthorNameLookupRequest : BaseRequest
    {
        public AuthorNameLookupRequest(string author)
        {
            Parameters.Add("results", BookResults.Details.ToString().ToLower());
            Value = author;
        }

        public override string ApiPage
        {
            get { return "authors.xml"; }
        }

        public override string Index
        {
            get { return "name"; }
        }

        public BookResults DesiredResult
        {
            get
            {
                var val = Parameters["results"].Value;
                return (BookResults)Enum.Parse(typeof(BookResults), val, true);
            }
            set
            {
                Parameters["results"].Value = value.ToString().ToLower();
            }
        }

        public override IResponseParser GetParser()
        {
            return new AuthorResponseParser();
        }
    }
}
